<%@ page import="com.tlb.ejb.*,com.tlb.dto.*,com.tlb.web.*,java.util.*" %>

<%

int postId = Integer.parseInt(request.getParameter("editPostId"));
int threadId = Integer.parseInt(request.getParameter("threadId"));
int x = Integer.parseInt(request.getParameter("x"));
String content = request.getParameter("content");

Poster p = new AuthManager(request, response).hardAuthenticatePoster();

ThreadDAO tdao = new ThreadDAO();
PostContent pc = tdao.getPostById(postId);





if(p.getPosterId() == pc.getMoniker().getPoste().getPosterId()) {
    pc.setContent(content);
    tdao.updatePost(pc);
    
    response.setStatus(response.SC_MOVED_TEMPORARILY);
    response.setHeader("Location", "http://" + Util.getUtil().getServerRoot(request) + "/blb/viewThread.jsp?threadId=" + threadId + "&x=" + x);
} else {
    session.invalidate();
    request.getRequestDispatcher("authError.jsp").forward(request, response);
}





%>

